
add_definitions(
-DUNICODE
-D_UNICODE
)


file(GLOB FIND_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
set(SOURCES  ${FIND_SRC})

file(GLOB FIND_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
list(APPEND SOURCES ${FIND_SRC})

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lua_UIParent.cpp
                     COMMAND ${TOLUABIN} -o ${CMAKE_CURRENT_BINARY_DIR}/lua_UIParent.cpp -L exceptions.lua UIParent.pkg
                     MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/UIParent.pkg
                     WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
                     COMMENT "generate lua_UIParent.cpp...")

#source_group( "lua_GUI" FILES  ${PKG_DIR}/GUI.pkg ${CMAKE_CURRENT_BINARY_DIR}/lua_UIParent.cpp)

include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )


add_library(UIParent SHARED
	${SOURCES}
	lua_UIParent.cpp
)

target_link_libraries(UIParent
	GUI
	d3d9.lib
	d3dx9.lib
	tolua++
	lua51
	StormLib
	Winmm.lib
	imm32.lib
)

set_target_properties(UIParent PROPERTIES FOLDER lualibs)
install (TARGETS UIParent RUNTIME DESTINATION ${INSTALL_DIR})
install(TARGETS UIParent ARCHIVE DESTINATION ${LIBRARY_DIR})
